<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>这是页面标题</title>
</head>
<body>
    <script>
        let a = {}; // 创建一个空对象

        let student = {
            // 属性
            name: "张三",
            age: 20,
            gender: "男",
            // 方法
            sayHello: function () {
                console.log("Hello, My name is " + this.name + "!");
            }
        };

        console.log(student.name);
        console.log(student.age);
        console.log(student.gender);
        student.sayHello();

        // console.log(student[name]); // error
        // console.log(student["name"]);

        // 修改对象的属性
        student.name = "李四";
        console.log(student.name);
        // 增加对象的属性
        student.job = "学生";
        console.log(student.job);
        // 删除对象的属性
        delete student.job;
        console.log(student.job);
        console.log(student);

    </script>
</body>
</html>